popover: Unrealize when autohide prop changes
authorJonas Ådahl <jadahl@gmail.com>
Wed, 24 Jul 2019 13:45:34 +0000 (15:45 +0200)
committerJonas Ådahl <jadahl@gmail.com>
Wed, 19 Feb 2020 08:47:18 +0000 (09:47 +0100)
Changing the autohide property means the popover needs to be remapped.
Remapping may need user interaction, so lets just unrealize the popover
if the property changes, forcing the application to remap it should it
be shown again.

gtk/gtkpopover.c

index af1fee728beece4a4d4a888e81651f6f232b2f02..b626a3fbd661e58b9853fabcc9f04deacb63624b 100644 (file)
@@ -1649,6 +1649,9 @@ gtk_popover_get_position (GtkPopover *popover)
  * A modal popover will grab the keyboard focus on it when being
  * displayed. Clicking outside the popover area or pressing Esc will
  * dismiss the popover.
+ *
+ * Called this function on an already showing popup with a new autohide value
+ * different from the current one, will cause the popup to be hidden.
  **/
 void
 gtk_popover_set_autohide (GtkPopover *popover,
@@ -1665,6 +1668,8 @@ gtk_popover_set_autohide (GtkPopover *popover,
 
   priv->autohide = autohide;
 
+  gtk_widget_unrealize (GTK_WIDGET (popover));
+
   g_object_notify_by_pspec (G_OBJECT (popover), properties[PROP_AUTOHIDE]);
 }